#!/bin/sh
# Copyright 2001 BSDi, Inc, Concord, CA.  Written by volkerdi@slackware.com.
# Copyright 2004 Slackware Linux, Inc., Concord, CA.
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Modified by rs Lange of Vector Linux. Formally called xorgsetup

# WE WILL USE THIS AS A TEMPLATE FOR A GAMBAS PORT


vdir=/sbin  ##$(dirname $0)
. $vdir/vasm-functions
check_root

if [ $DISPLAY ]; then
  DIALOG=Xdialog
else
  DIALOG=dialog
fi

# If we aren't root, bail:
if [ "$UID" = "0" ]; then
  TMP=/var/log/setup/tmp
else
  clear
  echo "Only root can configure X......bailing"
  sleep 8
  exit
fi

# Now, this wouldn't make much sense either:
if [ ! -x /usr/bin/Xorg ]; then
  echo "No X found so bailing............"
  sleep 8
  exit
fi

$DIALOG --title "CONFIGURE X SERVER?" \
  --menu "Would you like to probe for your video hardware and mouse, and \n
write an initial configuration file to /etc/X11/xorg.conf? \n
The VXCONF option will give you the classic VL vxconf setup. \n
You need to use VXCONF for proprietary drivers, \n
or if you want to specify depth or resolution. \n
The AUTO option will try to setup X for you with ZERO questions. \n
The vesa option works for most cards including virtual machines. \n
The fbdev option uses the kernel frame buffer device." 18 90 8 \
  "VXCONF" "Auto probe to setup xorg.conf" \
  "AUTO" "FULL-AUTO-PROBE no questions" \
  "VESA" "Use default xorg.conf-vesa" \
  "FBDEV" "Use default xorg.conf-fbdev" \
  "EXIT" "Exit and skip xorg.conf config" 2> $TMP/color
if [ ! $? = 0 ]; then
rm -f $TMP/color
exit 1
fi
choice=$(cat $TMP/color)
if [ "$choice" = "EXIT" ]; then
	rm -f $TMP/color
	exit 0
fi
if [ "$choice" = "AUTO" ]; then
	/sbin/VLsetup
	/sbin/VLXconf
	exit 0
fi
if [ "$choice" = "VESA" ]; then
	mv /etc/X11/xorg.conf /etc/X11/xorg.conf.back 2>/dev/null
  	ln -s /etc/X11/xorg.conf-vesa /etc/X11/xorg.conf
	exit 0
fi
if [ "$choice" = "FBDEV" ]; then
	mv /etc/X11/xorg.conf /etc/X11/xorg.conf.back 2>/dev/null
  	ln -s /etc/X11/xorg.conf-fbdev /etc/X11/xorg.conf
	exit 0
fi
if [ ! -d $TMP ]; then
 mkdir -p $TMP
 chmod 700 $TMP
fi

# OK, we'll warn the user if there's already an existing xorg.conf:
CONFIG_EXISTS=false
for xf86config in /etc/X11/xorg.conf /etc/xorg.conf /usr/X11R6/lib/X11/xorg.conf $HOME/xorg.conf ; do
  if [ -r $xf86config ]; then
    CONFIG_EXISTS=$xf86config
  fi  
done
if [ ! "$CONFIG_EXISTS" = "false" ]; then
  $DIALOG --title "FOUND EXISTING xorg.conf in $(dirname $CONFIG_EXISTS)" \
  --msgbox "A previous X Window System configuration file has been found. \n
  You can now reconfigure X, replacing the file with a new version (and \n
  keeping a backup of the old file), or you can abort leaving the existing \n
  config file in place.  Hit ENTER to rename the xorg.conf file to \n
  xorg.conf.backup and create a new one, or ESC to abort." 10 80
  if [ ! $? = 0 ]; then
    exit
  fi
fi
# Move any existing config file(s) aside:
for xf86config in /etc/X11/xorg.conf /etc/xorg.conf /usr/X11R6/lib/X11/xorg.conf $HOME/xorg.conf ; do
  if [ -r $xf86config ]; then
    mv $xf86config ${xf86config}.backup
  fi  
done

if ( ls /var/log/packages | grep -iq fglrx ) then
  #/usr/share/ati/fglrx-uninstall.sh >/dev/null && removepkg fglrx >/dev/null
 /sbin/installpkg /usr/src/vl-pkgs/lzma* >/dev/null
fi

# check for vmware video device
if ( lspci | grep -i vga | grep -iq vmware ) then
	cp /etc/X11/xorg.conf.in /$HOME/xorg.conf.new
	vmware=1
#check for ati video card
elif ( lspci | grep -i vga | grep -iq " ati " ) then
 fixati=1
 if [ -x $vdir/vlati ];then
  $vdir/vlati
    ati=1
 else
    ati=1
  # Have the X server create a default config file:
  echo "Detecting Hardware"
  /usr/bin/X -configure :2 2> /dev/null
  if [ ! $? = 0 ]; then
   # failure, bail.
   exit
  fi
 fi
else
#check for nvidia video card
  if ( lspci | grep -i vga | grep -iq nvidia ) then
    nvidia=1
  fi
#check for problem intel video
  if ( lspci | grep -i vga | grep -iq 82815 ) then
    i815=1
  fi
  # Have the X server create a default config file:
  echo "Detecting Hardware"
  /usr/bin/X -configure :2 2> /dev/null
  if [ ! $? = 0 ]; then
   # failure, bail.
   exit
  fi
fi

##We may need horiz and vert refresh rates later so lets get them now
ddcxinfo -hsync > $TMP/hsync
ddcxinfo -vsync > $TMP/vsync
vert=$(cat $TMP/vsync)
horiz=$(cat $TMP/hsync)
if [ "$vert" = "0-0" ] || [ "$vert" = "" ] ; then
  vert="40-90"
fi
if [ "$horiz" = "0-0" ] || [ "$horiz" = "" ]; then
  horiz="31.5-64"
fi
#check the keyboard
$DIALOG --title "KEEP DEFAULT KEYBOARD MAP AND LAYOUT" \
--yesno "Would you like to KEEP the default (US) keyboard setup? \n
 if you choose NO you can change both the keymap and keyboard type\n
 from the default Setting \
US and pc102" 8 70 2> /dev/null
if [ ! $? = 0 ]; then
  vxkbset
fi	


# OK, so now that we have a default file in $HOME/xorg.conf.new
# we can set up a default color depth:
clear
$DIALOG --title "SELECT DEFAULT COLOR DEPTH" \
  --menu "Now you may select a default color depth for the X server:" 13 70 6 \
  "24" "24 bit True Color" \
  "16" "16 bit Pseudo Color" \
  "8" "8 bit 256 Color" \
  "4" "4 bit 16 Color" \
  "1" "1 bit Mono B/W" \
  "none" "Go with driver default (usually 8-bit)" 2> $TMP/colordepth
if [ ! $? = 0 ]; then
  rm -f $TMP/colordepth
  exit 1
fi
depth=$(cat $TMP/colordepth)
sleep 2
##############################################################
##now lets get a default screen resolution
clear
$DIALOG --title "SELECT DEFAULT MONITOR RESOLUTION" \
 --menu "Please select your default screen resolution from the menu below. \n
The resolution selected should be the best your monitor will handle. \n
AutoConfig will get the max for monitors with full DPMS support. \n
For most modern monitors a selection of 1024X768 is a good choice. \n
Older monitors may only be able to do 800X600. \n
Please select a resolution now." 20 80 8 \
"1024x768" "If you have a recent 15 or 17 inch monitor OK" \
"1280x1024" "Very new monitors or lcd screens" \
"1280x800" "New Widescreen monitors and laptops" \
"1440x900" "You know if you have this one...nice!" \
"1600x1200" "You know if you have this one...wow!" \
"800x600" "Any SVGA monitor should be able to do this"  \
"640x480" "The most basic vga monitor" \
"1920x1080" "HDTV You know if you have this" \
"AutoConfig" "Choose this and X will figure it out" 2> $TMP/resolution
if [ ! $? = 0 ]; then
rm -f $TMP/resolution
exit 1
fi
res=$(cat $TMP/resolution)

##set resolution modes
if [ "$res" = "640x480" ]; then
  finalres="Modes \"640x480\" \"800x600\""
fi
if [ "$res" = "800x600" ]; then
  finalres="Modes \"800x600\" \"640x480\""
fi
if [ "$res" = "1024x768" ]; then
  finalres="Modes \"1024x768\" \"800x600\" \"640x480\""
fi
if [ "$res" = "1280x1024" ]; then
  finalres="Modes \"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""
fi
if [ "$res" = "1440x900" ]; then
  finalres="Modes \"1440x900\" \"1280x800\" \"1024x768\" \"800x600\" \"640x480\""
fi
if [ "$res" = "1280x800" ]; then
  finalres="Modes \"1280x800\" \"1024x768\" \"800x600\" \"640x480\""
fi
if [ "$res" = "1600x1200" ]; then
  finalres="Modes \"1600x1200\" \"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""
fi
if [ "$res" = "1920x1080" ]; then
  finalres="Modes \"1920x1080\" \"1600x1200\" \"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""
fi

# I know this completely hoses the indentation of the xorg.conf file, but
# really don't know a good way around that.  Shoulda used perl.  ;)
START_LOOKING=false
rm -f /etc/X11/xorg.conf
. /etc/sysconfig/vector

if grep "HorizSync" $HOME/xorg.conf.new|grep -v "#";then
  fixsync="no"
else
  fixsync="yes"
fi
DPMS="   Option \"DPMS\"" 
##"$( sed -n '/^ *Section *\"Monitor\" *$/,/^ *EndSection *$/p' $HOME/xorg.conf.new | grep "DPMS")"

cat $HOME/xorg.conf.new | while read LINE ; do
  echo "$LINE" >> /etc/X11/xorg.conf
  if echo $LINE | grep Section | grep Screen 1> /dev/null ; then
    START_LOOKING=true
  fi
  if [ "$START_LOOKING" = "true" ]; then
   if echo $LINE | grep Monitor 1> /dev/null ; then
     if [ ! "$depth" = "none" ]; then
       echo "DefaultDepth $depth" >> /etc/X11/xorg.conf
     fi
     START_LOOKING=false
   fi
 fi
 ## add cyrillic fonts to font path
 if echo $LINE | grep 100dpi 1> /dev/null ; then
   echo "FontPath     \"/usr/lib/X11/fonts/truetype/\"
FontPath     \"/usr/lib/X11/fonts/local/\"
FontPath     \"/usr/lib/X11/fonts/cyrillic/\" " >> /etc/X11/xorg.conf
 fi
 ##lets try a default resolution
 if [ ! "$res" = "none" ]; then 
  if echo $LINE | grep ^Depth 1> /dev/null ; then
    echo $finalres >> /etc/X11/xorg.conf
  fi
 fi
if [ "$nvidia" = 1 ];then
    if echo $LINE | grep Section | grep Module\" 1> /dev/null ; then
      if ! cat $HOME/xorg.conf.new | grep Load | grep glx\" 1> /dev/null ; then
        echo Load  \"glx\" >>/etc/X11/xorg.conf
      fi
    fi
    if echo $LINE |grep Section|grep \"Device\" 1> /dev/null ; then
      echo Option   \"UseEdidDpi\" \"false\" >>/etc/X11/xorg.conf
      echo Option   \"DPI\" \"96 x 96\" >>/etc/X11/xorg.conf
      echo  "Option \"AddARGBGLXVisuals\" \"True\" " >>/etc/X11/xorg.conf
      echo  "Option \"RenderAccel\" \"true\" " >>/etc/X11/xorg.conf
      echo  "Option \"AllowGLXWithComposite\" \"true\" " >>/etc/X11/xorg.conf

    fi
fi
if echo $LINE |grep Section|grep \"Monitor\" 1> /dev/null ; then
  grep $res /etc/X11/96DPI >>/etc/X11/xorg.conf
  echo "  Option \"UseEdidFreqs\" \"1\" " >>/etc/X11/xorg.conf
fi

 ##now the wheel for a mouse
#if echo $LINE | grep Device | grep mouse 1> /dev/null ; then
#  echo "Option  \"ZAxisMapping\" \"4 5\"" >> /etc/X11/xorg.conf
#fi

 
 ##now keyboard setting if none us
 if [ ! $XKBMAP ]; then
   XKBMAP=us
 fi
 if [ $XKBMAP ]; then
  if echo $LINE | grep Driver | grep kbd 1> /dev/null ; then
    echo "Option  \"XkbLayout\"  \"$XKBMAP\"    ## KEYBOARD_MAP!" >> /etc/X11/xorg.conf
  fi
 fi
# if [ $XKBMODEL ]; then
  if echo $LINE | grep Driver | grep kbd 1> /dev/null ; then
    echo "Option  \"XkbModel\"  \"$XKBMODEL\"    ## KEYBOARD_MODEL!" >> /etc/X11/xorg.conf
  fi
# fi
# if [ $XKBVAR ]; then
  if echo $LINE | grep Driver | grep kbd 1> /dev/null ; then
    echo "Option  \"Xkbvariant\"  \"$XKBVAR\"    ## KEYBOARD_VARIANT!" >> /etc/X11/xorg.conf
  fi

# fi
 ##last monitor refresh if not auto detected
#echo $fixsync
 if [ "$fixsync" = "yes" ]; then
  if echo $LINE | grep ModelName 1> /dev/null ; then
    echo "HorizSync $horiz" >> /etc/X11/xorg.conf
  fi
 fi
 if [ "$fixsync" = "yes" ]; then
  if echo $LINE | grep ModelName 1> /dev/null ; then
    echo "VertRefresh $vert" >> /etc/X11/xorg.conf
  fi
 fi				
done

rm -f $TMP/colordepth
rm -f $TMP/resolution
rm -f $TMP/vsync
rm -f $TMP/hsync
rm -f $HOME/xorg.conf.new
clear

##  Test for 2 video cards
if [ "$(grep "^Driver" /etc/X11/xorg.conf | grep -v kbd | grep -v mouse | wc | cut -d " " -f7)" -gt 1 ]; then
     cards=$(grep "^Vendor" /etc/X11/xorg.conf | grep -v Mon | cut -d " " -f3 | cut -c 2-)
     for i in $cards; do
       echo $i >>/tmp/cards
       card[$j]="$i"
       j=$(expr $j + 1)
     done
     $DCMD --backtitle "$BACKTITLE" --title "Choose Video Card" --menu "\n
     We have found more than 1 video card, and for X to work \n
     we need to know which card your monitor is connected to.\n
     Choose which video card you would like to use" \
     20 74 8 \
     ${card[0]} ${card[0]} \
     ${card[1]} ${card[1]} \
     ${card[2]} ${card[2]} \
     2> $freply

     cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

     card1=$(cat $freply)
     card2=$(cat /tmp/cards | grep -v $card1)
     sed '/Card[0-2]/ d' /etc/X11/xorg.conf > /etc/X11/xorg.conf.1
     rm /etc/X11/xorg.conf
     cat /etc/X11/xorg.conf.1 | while read LINE ; do
       echo "$LINE" >> /etc/X11/xorg.conf.2
       if echo $LINE | grep $card1 1> /dev/null ; then
         echo Identifier  \"Card0\" >> /etc/X11/xorg.conf.2
       fi
       if echo $LINE | grep Section | grep Screen 1> /dev/null ; then
         echo Device     \"Card0\" >> /etc/X11/xorg.conf.2
       fi
     done
     cat /etc/X11/xorg.conf.2 | while read LINE ; do
       echo "$LINE" >> /etc/X11/xorg.conf
       if echo $LINE | grep $card2 1> /dev/null ; then
         echo Identifier  \"Card1\" >> /etc/X11/xorg.conf
       fi
     done
       rm /tmp/cards
       rm /etc/X11/xorg.conf.1
       rm /etc/X11/xorg.conf.2
fi

### intel i810 video has a problem without this hack
cat /etc/X11/xorg.conf | grep Driver | grep i810 1> /dev/null
if [ $? = 0 ]; then
uname -r | cut -f 1,2 -d '.' > $TMP/kernel
kernel=$(cat $TMP/kernel)
rm -f $TMP/kernel
 if [ $kernel = "2.6" ]; then
  /sbin/modprobe intel-agp && echo "/sbin/modprobe intel-agp" >> /etc/rc.d/rc.modules
 fi
fi
cat /etc/X11/xorg.conf | grep Driver | grep intel 1> /dev/null
if [ $? = 0 ]; then
uname -r | cut -f 1,2 -d '.' > $TMP/kernel
kernel=$(cat $TMP/kernel)
rm -f $TMP/kernel
 if [ $kernel = "2.6" ]; then
  /sbin/modprobe intel-agp && echo "/sbin/modprobe intel-agp" >> /etc/rc.d/rc.modules
  /sbin/modprobe drm && echo "/sbin/modprobe drm" >> /etc/rc.d/rc.modules
  /sbin/modprobe i915 && echo "/sbin/modprobe i915" >> /etc/rc.d/rc.modules
 fi
fi

fixnv=0
fixati=0
fixnvidia=0
cat /etc/X11/xorg.conf | grep Driver | grep "\"nv\"" 1> /dev/null
if [ $? = 0 ]; then
 sed s'/nv/vesa/'g /etc/X11/xorg.conf > /etc/X11/xorg.conf.new
 mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
 fixnv=1
fi
cat /etc/X11/xorg.conf | grep Driver | grep "\"nvidia\"" 1> /dev/null
if [ $? = 0 ]; then
 sed s'/nvidia/vesa/'g /etc/X11/xorg.conf > /etc/X11/xorg.conf.new
 mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
 fixnvidia=1
fi
if [ "$fixnv" = 0 ] && [ "$fixnvidia" = 0 ];then
 echo Section \"DRI\" >> /etc/X11/xorg.conf
 echo 	Mode         0666 >> /etc/X11/xorg.conf
 echo EndSection >> /etc/X11/xorg.conf
 echo "              " >> /etc/X11/xorg.conf
 echo Section \"Extensions\" >> /etc/X11/xorg.conf
 echo  Option \"Composite\" \"on\" >> /etc/X11/xorg.conf
 echo EndSection >> /etc/X11/xorg.conf
elif [ "$i810" = 1 ];then
 echo #Section \"Extensions\" >> /etc/X11/xorg.conf
 echo  #Option \"Composite\" \"on\" >> /etc/X11/xorg.conf
 echo #EndSection >> /etc/X11/xorg.conf
else
 echo Section \"Extensions\" >> /etc/X11/xorg.conf
 echo  Option \"Composite\" \"on\" >> /etc/X11/xorg.conf
 echo EndSection >> /etc/X11/xorg.conf
fi
if [ "$fixnv" = 1 ] || [ "$fixnvidia" = 1 ] ;then
  sed s'/Load  \"dri\"/#Load  \"dri\"/'g /etc/X11/xorg.conf > /etc/X11/xorg.conf.new
  mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
  if [ -x /sbin/vlnvidia ];then
    /sbin/vlnvidia
  else
    sed s'/vesa/nv/'g /etc/X11/xorg.conf > /etc/X11/xorg.conf.new && \
    mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
  fi
fi
if [ "$i810" = 1 ];then
  sed s'/Load  \"dri\"/#Load  \"dri\"/'g /etc/X11/xorg.conf > /etc/X11/xorg.conf.new
  mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
fi
  sed s'/4 5 6 7/4 5/'g /etc/X11/xorg.conf > /etc/X11/xorg.conf.new
  mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf

sleep 1
if [ "$vmware" = 1 ];then
 sed s'/vesa/vmware/'g /etc/X11/xorg.conf > /etc/X11/xorg.conf.new
 mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
fi
if [ "$ati" = 1 ];then
  if grep "Driver" /etc/X11/xorg.conf|grep fglrx;then
    $DIALOG --title "X WAS CONFIGURED"  \
    --msgbox "Your new X configuration file has been saved to /etc/X11/xorg.conf. \n
    You have chosen to use the Proprietary FGLRX driver. This driver works for many newer ati radeon cards. However we can not test this driver without having you reboot Please reboot and check if this driver works. if not run vxconf from vasm and choose an alternate driver." \
    13 72
    exit 0
  fi
fi
dpms=$(sed -n '/^ *Section *\"Monitor\" *$/,/^ *EndSection *$/p' /etc/X11/xorg.conf | grep "DPMS")
if [ "$dpms" = "" ];then
  cat /etc/X11/xorg.conf | while read LINE ; do
    echo "$LINE" >> /etc/X11/xorg.conf.new
    if echo $LINE |grep Section|grep \"Monitor\" 1> /dev/null ; then
      echo $DPMS >> /etc/X11/xorg.conf.new
    fi
  done
  mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
fi

echo "Testing configuration...........hold tight!!!!"
Xorg -probeonly :2 2> /dev/null
if [ "$?" = 0 ];then
$DIALOG --title "X WAS CONFIGURED SUCCESSFULLY"  \
--msgbox "Your new X configuration file has been saved to /etc/X11/xorg.conf. \n
You may still need to add or adjust some values in the file to \n
achieve the desired screen resolution. For example, some monitors \n
would require \"HorizSync 30-55\" in the \"Monitor\" section of \n
the configuration file. For complete information about making \n
these adjustments, please refer to \"man xorg.conf\"." \
13 72
 exit 0

else
  $DCMD --backtitle "$BACKTITLE" --title "X configuration ERROR" --menu \
   "There was an error in your X configuration.\n
 /etc/X11/xorg.conf file as autoconfig must have stumbled somewhere. \n
 Please Choose one of the following resolutions." 20 71 4\
    "RETRY" "Retry X configuration" \
    "EDIT" "edit xorg.conf with mcedit" \
    "VESA" "try the default xorg.conf-vesa" \
    "Exit" "Exit X config and fix xorg.conf manually" \
    2> $freply
     result=$?
     if [ $result != 0 ];then
       exit 0
     fi
     ANS="`cat $freply`"
     case "$ANS" in
      "RETRY")
       /sbin/vxconf
       exit 0
       ;;
      "EDIT")
       /usr/bin/mcedit /etc/X11/xorg.conf
       exit 0
       ;;
      "VESA")
       mv /etc/X11/xorg.conf /etc/X11/xorg.conf.back 2>/dev/null
       ln -s /etc/X11/xorg.conf-vesa /etc/X11/xorg.conf
       exit 0
       ;;
      "EXIT")
       exit 0
       ;;
    esac
 exit 1
fi
# yesnobox "There was an error in your X configuration. Would you like to edit the \n
# /etc/X11/xorg.conf file as autoconfig must have stumbled somewhere? \n
# Choosing yes here will start a text mode configuration utility. \n
# Choose no if you wish to edit later from the installation." 
# if [ $? = 0 ]; then
# /usr/bin/mcedit /etc/X11/xorg.conf
#	mv /etc/X11/xorg.conf /etc/X11/xorg.conf.back 2>/dev/null
#  	ln -s /etc/X11/xorg.conf-vesa /etc/X11/xorg.conf
 #/usr/X11R6/bin/xorgcfg -textmode
# fi

